home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
dirut
/
where12.zip
/
WHERE.DOC
< prev
Wrap
Text File
|
1993-10-21
|
2KB
|
62 lines
WHERE (v1.2) - Where is a file in the PATH or other environment variable
Copyright 1989-1993 by David G. Thomas
You may use this program as you please, and may distribute it
to your friends. You may NOT alter the program, and you MUST
include this file when you pass it on.
This program saves typing as it will "find" a file for you. The E.BAT
in our example at the bottom of this file edits a file by name (not path).
For example, to look at the standard C include file, "MALLOC.H", simply
type "E MALLOC", and it will edit "H:\LANG\MSC51\INCLUDE\MALLOC.H".
USAGE:
WHERE name - Look in PATH for name.bat name.com name.exe
WHERE env_var name - Look in env_var for name
WHERE env_var name .suf - Look in env_var for name.suf
WHERE dir;dir name .suf - Look in the dirs for name.suf
Options (must be first arg)
-Env - The results are placed in the RET environment variable
-Full - Return the fully qualified path
-Name - Print name only
-Quiet - Do not print File Not Found message
-Subst - Return the fully qualified path, chasing SUBST disk
-Upper - Results are upper case
Errorlevel is set to the number of files found.
E.BAT
------------------------
@echo off
:* This batch file will edit a file, given only the file name.
:* If necessary, it will search the INCLUDE and PATH environment
:* paths for the file. Also, a special path named E_PATH is used.
if exist %1 goto use_args
set RET=
where -q -e E_PATH %1 .c .h .bat
if errorlevel 1 goto frompath
where -q -e INCLUDE %1 .h
if errorlevel 1 goto frompath
where -q -e PATH %1 .bat .doc .txt
if errorlevel 1 goto frompath
:use_args
edit %1 %2 %3 %4 %5 %6 %7
goto end
:frompath
edit %ret%
:end